package com.youngjun.user.api.admin;

import com.youngjun.common.mybatis.page.PageInfo;
import com.youngjun.common.mybatis.web.Response;
import com.youngjun.user.pojo.dto.InterfaceDTO;
import com.youngjun.user.pojo.dto.query.FunctionInterfaceQueryDTO;
import com.youngjun.user.pojo.dto.query.InterfaceQueryDTO;
import com.youngjun.user.pojo.vo.InterfaceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "接口管理")
@FeignClient(
        name = "${ums.api.name:ums-service}",
        contextId = "interfaceRestApi",
        url  = "${ums.api.url:http://127.0.0.1:8080}",
        path = "/interface"
)
public interface IInterfaceRestApi {


    @ApiOperation(value="查询未分配的接口信息")
    @RequestMapping(method = RequestMethod.POST, path = "/query_unassigned_list")
    Response<PageInfo<InterfaceVO>> queryUnAssignedList(@RequestBody FunctionInterfaceQueryDTO dto);

    @ApiOperation(value="查询已分配的接口信息")
    @RequestMapping(method = RequestMethod.POST, path = "/query_assigned_list")
    Response<List<InterfaceVO>> queryAssignedList(@RequestBody FunctionInterfaceQueryDTO dto);

    @ApiOperation(value="查询接口信息")
    @RequestMapping(method = RequestMethod.POST, path = "/query_list")
    Response<PageInfo<InterfaceVO>> queryList(@RequestBody InterfaceQueryDTO dto);

    @ApiOperation(value="创建接口信息")
    @RequestMapping(value = "/create",method = RequestMethod.POST)
    Response<InterfaceVO> create(@RequestBody @Valid InterfaceDTO dto);

    @ApiOperation(value="修改接口信息")
    @RequestMapping(value = "/modify",method = RequestMethod.PUT)
    Response<InterfaceVO> modify(@RequestBody @Valid InterfaceDTO dto);

    @ApiOperation(value="删除接口信息")
    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    Response<Void> delete(@RequestParam("id") Long id);


}